package com.atguigu.chapter05.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/7/16 11:28
 */
public class Flink02_Source_Collection {
    public static void main(String[] args) throws Exception {
        // file socket
        
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(10);
        list.add(20);
        list.add(30);
        
        //        DataStreamSource<Integer> source = env.fromCollection(list);
        
        //DataStreamSource<Integer> source = env.fromElements(1, 10, 20, 30, 40);
        
        DataStreamSource<ArrayList<Integer>> source = env.fromElements(list);
        source.print();
        
        env.execute();
        
    }
    
}
